package model;
import java.util.*;

/**
 * Created by 杨珂 on 2016/8/9.
 */
public class UserCard {
    
	private int userCardId;
    private int userId;
    private int cardType;
    private Date openTime;
    private Date endTime;
    private int count;
    
    public UserCard() {}
    //年卡构造方法
    public UserCard(int userId, int cardType) {
    	this.userId = userId;
    	this.cardType = cardType;
    	openTime = new Date();
    	//年卡，结束日期加1年
    	Calendar rightNow = Calendar.getInstance();
        rightNow.setTime(openTime);
        rightNow.add(Calendar.YEAR,+1);
        endTime = rightNow.getTime();
    }
    //次卡构造方法
    public UserCard(int userId, int cardType, int count) {
    	this.userId = userId;
    	this.cardType = cardType;
    	openTime = new Date();
    	//次卡，结束日期加3年
    	Calendar rightNow = Calendar.getInstance();
        rightNow.setTime(openTime);
        rightNow.add(Calendar.YEAR,+3);
        endTime = rightNow.getTime();
        this.count = count;
    }

    public int getUserCardId() {
		return userCardId;
	}
	public void setUserCardId(int userCardId) {
		this.userCardId = userCardId;
	}
	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public int getCardType() {
		return cardType;
	}
	public void setCardType(int cardType) {
		this.cardType = cardType;
	}
	public Date getOpenTime() {
		return openTime;
	}
	public void setOpenTime(Date openTime) {
		this.openTime = openTime;
	}
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	public int getCount() {
		return count;
	}
	public void setCount(int count) {
		this.count = count;
	}

}
